Skip to content

feat: import system (v0.1.0)#29

Merged
IMisbahk merged 8 commits intomasterfrom
codex
Mar 22, 2026
Merged

feat: import system (v0.1.0)#29
IMisbahk merged 8 commits intomasterfrom
codex

Conversation

@IMisbahk
Copy link
Collaborator

What

Implemented full import system support for Rey and rebased it cleanly on current master.

  • Added export pub function modifier support
  • Enforced visibility rules:
    • export pub func is importable
    • pub func is not importable from other files/modules
    • func is private
  • Added file-level imports:
    • import actuator.name
    • import actuator.{name, other}
  • Added module-level imports:
    • import action
    • import action::walk
    • import action::{walk, run}
  • Implemented resolver order:
    1. current file directory
    2. project root (entry file directory)
    3. ~/.reyc/std/src for std-prefixed resolution
    4. ~/.reyc/packages for package resolution
  • Added module behavior:
    • folder must contain main.rey for import module
    • module namespace auto-collects export pub symbols from rey files in the folder
    • module::item resolves direct file namespaces
  • Implemented scope injection behavior:
    • file symbol imports inject direct names
    • module imports inject namespace objects used as namespace.func()
  • Added compile-time diagnostics for:
    • file not found
    • missing main.rey in module folder
    • function not found
    • function exists but is pub (not export pub)
    • circular imports (cycle shown)
    • duplicate imports
  • Added import fixtures in tests/imports for success and error scenarios.

Why

Rey needed a deterministic import model with explicit export visibility and clear compile-time diagnostics for modular programs.

Verification

  • cargo build passes
  • cargo test passes

@IMisbahk IMisbahk merged commit 4cf3adc into master Mar 22, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants